package ru.fadeev.crammer.phb;

public class PhrasesBankClient {
	public static void main(String [] args) throws Exception {
		// Make a service
		ru.fadeev.crammer.phb.ws.PhrasesBankService service = 
		     new ru.fadeev.crammer.phb.ws.PhrasesBankServiceLocator();
		
		
		// Now use the service to get a stub to the service
		ru.fadeev.crammer.phb.ws.PhrasesBank_PortType phb = service.getPhrasesBank();
		ru.fadeev.crammer.phb.ws.WordsBatch wordsBatch = new ru.fadeev.crammer.phb.ws.WordsBatch();
		String[] words = {"Test"};
		wordsBatch.setWords(words);
		wordsBatch.setLanguage("EN");
		// Make the actual call
		ru.fadeev.crammer.phb.ws.PhrasesBatch phrasesBatch = phb.getPhrases(wordsBatch, 100);
		String[] phrases = phrasesBatch.getPhrases();
		System.out.println("Response:\n length = " + phrases.length);
		System.out.println(" language: "+ phrasesBatch.getLanguage());
		for(int i = 0 ; i < phrases.length; i++) {
			System.out.println(phrases[i]);
		}
		
	}
}
